# -- Add target to global list --
list(APPEND MOD_FEM_EXEC_LIST "CREATE_MOD_FEM_ELAST_PRISM_STD")
list(APPEND MOD_FEM_EXEC_LIST "CREATE_MOD_FEM_ELAST_HYBRID_STD")
list(APPEND MOD_FEM_EXEC_LIST "CREATE_MOD_FEM_ELAST_PRISM2D_STD") 
set(MOD_FEM_EXEC_LIST "${MOD_FEM_EXEC_LIST}" PARENT_SCOPE)

# -- Exec files --
set(pdd_elast_srcdir "${CMAKE_SOURCE_DIR}/pdd_elast")
set(PDD_ELAST_PRISM_STD_EXE "MOD_FEM_elast_prism_std")
set(PDD_ELAST_HYBRID_EXE "MOD_FEM_elast_hybrid_std")
set(PDD_ELAST_PRISM2D_STD_EXE "MOD_FEM_elast_prism2d_std")
# -- Include directories --
list(APPEND PDD_ELAST_INCLUDE_DIRS
  ${pdd_elast_srcdir}
)
if(PDD_ELAST_INCLUDE_DIRS)
  set(PDD_ELAST_INCLUDE_DIRS ${PDD_ELAST_INCLUDE_DIRS} PARENT_SCOPE)
endif()
# -- Source files list --
collect_src_from_include_dirs(PDD_ELAST_INCLUDE_DIRS)
# -- Target --
include_directories(${PDD_ELAST_INCLUDE_DIRS} ${PDD_ELAST_EXTERNAL_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include)

if(CREATE_MOD_FEM_ELAST_PRISM_STD)
  add_executable(${PDD_ELAST_PRISM_STD_EXE} ${SOURCE_FILES})
  target_link_libraries(${PDD_ELAST_PRISM_STD_EXE} ${PDD_ELAST_EXTERNAL_LIBRARIES} mml_prism apl_std_lin utl_system utl_util ${MODFEM_SOLVER_MODULE})
  SET_TARGET_PROPERTIES(${PDD_ELAST_PRISM_STD_EXE} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}" DEBUG_POSTFIX "_d")
  SET_TARGET_PROPERTIES(${PDD_ELAST_PRISM_STD_EXE} PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
endif()

if(CREATE_MOD_FEM_ELAST_HYBRID_STD)
  add_executable(${PDD_ELAST_HYBRID_STD_EXE} ${SOURCE_FILES})
  target_link_libraries(${PDD_ELAST_HYBRID_STD_EXE} ${PDD_ELAST_EXTERNAL_LIBRARIES} mml_t4_prism apl_std_lin utl_system utl_util ${MODFEM_SOLVER_MODULE})
  SET_TARGET_PROPERTIES(${PDD_ELAST_HYBRID_STD_EXE} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}" DEBUG_POSTFIX "_d")
  SET_TARGET_PROPERTIES(${PDD_ELAST_HYBRID_STD_EXE} PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
endif()

if(CREATE_MOD_FEM_ELAST_PRISM2D_STD)
  add_executable(${PDD_ELAST_PRISM2D_STD_EXE} ${SOURCE_FILES})
  target_link_libraries(${PDD_ELAST_PRISM2D_STD_EXE} ${PDD_ELAST_EXTERNAL_LIBRARIES} mml_prism_2D apl_std_lin utl_system utl_util ${MODFEM_SOLVER_MODULE})
  SET_TARGET_PROPERTIES(${PDD_ELAST_PRISM2D_STD_EXE} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}" DEBUG_POSTFIX "_d")
  SET_TARGET_PROPERTIES(${PDD_ELAST_PRISM2D_STD_EXE} PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
endif()
